package com.example.interview.no0102.solution;

import com.example.interview.no0102.Solution;

import java.util.Arrays;

/**
 * @Description 解答-判定是否互为字符重排
 * @ClassName ArraySolution
 * @Author Administrator
 * @Date 2020/7/7 19:36
 * @Version 1.0.0
 */
public class SortSolutionImpl implements Solution {
    @Override
    public boolean CheckPermutation(String s1, String s2) {
        if(s1.length() != s2.length()){
            return false;
        }
        char[] c1 = s1.toCharArray();
        Arrays.sort(c1);
        char[] c2 = s2.toCharArray();
        Arrays.sort(c2);
//        return new String(c1).equals(new String(c2));
        return Arrays.equals(c1, c2);
    }
}
